package cn.ht.jywrwater.module.ht.dal.mysql.statisticsdevicecount;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.statisticsdevicecount.StatisticsDeviceCountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.statisticsdevicecount.vo.*;

/**
 * 设备在线统计 Mapper
 *
 * @author hzx
 */
@Mapper
public interface StatisticsDeviceCountMapper extends BaseMapperX<StatisticsDeviceCountDO> {

    default PageResult<StatisticsDeviceCountDO> selectPage(StatisticsDeviceCountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StatisticsDeviceCountDO>()
                .eqIfPresent(StatisticsDeviceCountDO::getType, reqVO.getType())
                .eqIfPresent(StatisticsDeviceCountDO::getOnlineCount, reqVO.getOnlineCount())
                .eqIfPresent(StatisticsDeviceCountDO::getTotalCount, reqVO.getTotalCount())
                .betweenIfPresent(StatisticsDeviceCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StatisticsDeviceCountDO::getId));
    }

    default List<StatisticsDeviceCountDO> selectList(StatisticsDeviceCountExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StatisticsDeviceCountDO>()
                .eqIfPresent(StatisticsDeviceCountDO::getType, reqVO.getType())
                .eqIfPresent(StatisticsDeviceCountDO::getOnlineCount, reqVO.getOnlineCount())
                .eqIfPresent(StatisticsDeviceCountDO::getTotalCount, reqVO.getTotalCount())
                .betweenIfPresent(StatisticsDeviceCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StatisticsDeviceCountDO::getId));
    }

}
